package db.pojo;

import java.util.*;
import java.text.SimpleDateFormat;
import db.ext.Member_infoExt;
@SuppressWarnings("unchecked")
/**
 * member_info
 */
public class Member_info {
	/**
	 * MID
	 */
	public String mID;
	/**
	 * NAME
	 */
	public String nAME;
	/**
	 * SEX
	 */
	public String sEX;
	/**
	 * AGE
	 */
	public int aGE;
	/**
	 * PHONE
	 */
	public int pHONE;
	/**
	 * LEVEL
	 */
	public String lEVEL;
	/**
	 * LEVELNAME
	 */
	public String lEVELNAME;
	/**
	 * JOINTIME
	 */
	public String jOINTIME;
	/**
	 * CONDATION
	 */
	public String cONDATION;
	/**
	 * OTHERDATA
	 */
	public String oTHERDATA;
	SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	public static Member_infoExt DB = new Member_infoExt(); 
	
	public Member_info() {
		super();
	}
	
	public Member_info(String mID, String nAME, String sEX, int aGE, int pHONE, String lEVEL, String lEVELNAME, String jOINTIME, String cONDATION, String oTHERDATA) {
		super();
		this.mID = mID; 
		this.nAME = nAME; 
		this.sEX = sEX; 
		this.aGE = aGE; 
		this.pHONE = pHONE; 
		this.lEVEL = lEVEL; 
		this.lEVELNAME = lEVELNAME; 
		this.jOINTIME = jOINTIME; 
		this.cONDATION = cONDATION; 
		this.oTHERDATA = oTHERDATA; 
	}
	
	public String getMID() {
		return mID;
	}

	public void setMID(String mID) {
		this.mID = mID;
	} 
	
	public String getNAME() {
		return nAME;
	}

	public void setNAME(String nAME) {
		this.nAME = nAME;
	} 
	
	public String getSEX() {
		return sEX;
	}

	public void setSEX(String sEX) {
		this.sEX = sEX;
	} 
	
	public int getAGE() {
		return aGE;
	}

	public void setAGE(int aGE) {
		this.aGE = aGE;
	} 
	
	public void changeAGEWith(int aGE){
		this.aGE += aGE;
	}
	
	public void changeAGEWithMin(int aGE,int min){
		this.aGE += aGE;
		this.aGE = this.aGE < min ? min : this.aGE;
	}
	
	public void changeAGEWithMax(int aGE,int max){
		this.aGE += aGE;
		this.aGE = this.aGE > max ? max : this.aGE;
	}
	
	public void changeAGEWithMaxMin(int aGE,int max,int min){
		this.aGE += aGE;
		this.aGE = this.aGE < min ? min : this.aGE;
		this.aGE = this.aGE > max ? max : this.aGE;
	}	
	public int getPHONE() {
		return pHONE;
	}

	public void setPHONE(int pHONE) {
		this.pHONE = pHONE;
	} 
	
	public void changePHONEWith(int pHONE){
		this.pHONE += pHONE;
	}
	
	public void changePHONEWithMin(int pHONE,int min){
		this.pHONE += pHONE;
		this.pHONE = this.pHONE < min ? min : this.pHONE;
	}
	
	public void changePHONEWithMax(int pHONE,int max){
		this.pHONE += pHONE;
		this.pHONE = this.pHONE > max ? max : this.pHONE;
	}
	
	public void changePHONEWithMaxMin(int pHONE,int max,int min){
		this.pHONE += pHONE;
		this.pHONE = this.pHONE < min ? min : this.pHONE;
		this.pHONE = this.pHONE > max ? max : this.pHONE;
	}	
	public String getLEVEL() {
		return lEVEL;
	}

	public void setLEVEL(String lEVEL) {
		this.lEVEL = lEVEL;
	} 
	
	public String getLEVELNAME() {
		return lEVELNAME;
	}

	public void setLEVELNAME(String lEVELNAME) {
		this.lEVELNAME = lEVELNAME;
	} 
	
	public String getJOINTIME() {
		return jOINTIME;
	}

	public void setJOINTIME(String jOINTIME) {
		this.jOINTIME = jOINTIME;
	} 
	
	public String getCONDATION() {
		return cONDATION;
	}

	public void setCONDATION(String cONDATION) {
		this.cONDATION = cONDATION;
	} 
	
	public String getOTHERDATA() {
		return oTHERDATA;
	}

	public void setOTHERDATA(String oTHERDATA) {
		this.oTHERDATA = oTHERDATA;
	} 
	
	
	public Map member_infoToMap() {
		Map map = new HashMap();
		try {
			map.put("mID",this.mID);
			map.put("nAME",this.nAME);
			map.put("sEX",this.sEX);
			map.put("aGE",this.aGE);
			map.put("pHONE",this.pHONE);
			map.put("lEVEL",this.lEVEL);
			map.put("lEVELNAME",this.lEVELNAME);
			map.put("jOINTIME",this.jOINTIME);
			map.put("cONDATION",this.cONDATION);
			map.put("oTHERDATA",this.oTHERDATA);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return map;
	}

	public Member_info mapToMember_info(Map map){
		try {
			String mID =  map.get("mID").toString();
			String nAME =  map.get("nAME").toString();
			String sEX =  map.get("sEX").toString();
			int aGE = Integer.parseInt( map.get("aGE").toString());
			int pHONE = Integer.parseInt( map.get("pHONE").toString());
			String lEVEL =  map.get("lEVEL").toString();
			String lEVELNAME =  map.get("lEVELNAME").toString();
			String jOINTIME =  map.get("jOINTIME").toString();
			String cONDATION =  map.get("cONDATION").toString();
			String oTHERDATA =  map.get("oTHERDATA").toString();
			Member_info member_info = new Member_info(mID, nAME, sEX, aGE, pHONE, lEVEL, lEVELNAME, jOINTIME, cONDATION, oTHERDATA);
			return member_info;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	} 
	
	public String toString(){
		return member_infoToMap().toString();
	}
	
	//方便数据操作	
	public Member_info insert(){
		return DB.insert(this);
	}
	public Member_info update(){
		return DB.update(this);
	}
	
	public int delete(){
		return DB.delete(this);
	}
	
}
